<ion-view view-title="资料编辑">
    <ion-content>
        <!-- Forms -->
        <h4 class="border-top positive-900 text-center padding-top">
            <i class="icon ion-android-happy"></i>
            详细资料
        </h4>

        <div class="list">
            <div class="item">
                <span style="font-weight: bold;width:20%;">昵&nbsp;&nbsp;&nbsp;&nbsp;称</span>
                <span class="item-note">
                    {{weiInfo.nickname}}
                </span>
            </div>
            <a class="item item-icon-right" ng-click="openPhoneModal();">
                <span style="font-weight: bold;width:20%">手机号</span>
                <span class="item-note">
                    {{userInfo.telephone || '未设置'}}
                    <i class="icon ion-ios-arrow-thin-right"></i>
                </span>
            </a>
            <a class="item item-icon-right" ng-click="openNameModal();">
                <span style="font-weight: bold;width:20%">姓&nbsp;&nbsp;&nbsp;&nbsp;名</span>
                <span class="item-note">
                     {{userInfo.name || '未设置'}}
                    <i class="icon ion-ios-arrow-thin-right"></i>
                </span>
            </a>
            <a class="item item-icon-right" ng-click="openEmailModal();">
                <span style="font-weight: bold;width:20%">E-mail</span>
                <span class="item-note">
                     {{userInfo.email || '未设置'}}
                    <i class="icon ion-ios-arrow-thin-right"></i>
                </span>
            </a>

            <div class="item item-button-right">
                <span style="font-weight: bold;width:20%">管理收货地址</span>
                <button class="button button-energized-900 ink-dark" ng-click="openAddressModal();">
                    <i class="icon ion-ios-location"></i>
                </button>
            </div>

        </div>

    </ion-content>
</ion-view>

<script id="phoneModal.html" type="text/ng-template">
    <ion-modal-view>

        <div class="bar bar-header bar-energized-900">
            <button class="button button-icon button-clear ion-ios-arrow-back" ng-click="closePhoneModal();"></button>
            <h1 class="title" style="color:#fff;">手机号</h1>
            <button class="button button-clear" style="top:0;bottom:0;font-size:0.8em;" ng-click="saveTelephone();">保存
            </button>
        </div>

        <ion-content class="has-header">
            <label class="item item-input item-floating-label">
                <span class="input-label has-input">手机号</span>
                <input type="text" placeholder="输入手机号" ng-model="userObj.telephone">
            </label>
        </ion-content>
    </ion-modal-view>
</script>


<script id="nameModal.html" type="text/ng-template">
    <ion-modal-view>

        <div class="bar bar-header bar-energized-900">
            <button class="button button-icon button-clear ion-ios-arrow-back" ng-click="closeNameModal();"></button>
            <h1 class="title" style="color:#fff;">姓名</h1>
            <button class="button button-clear" style="top:0;bottom:0;font-size:0.8em;" ng-click="saveName();">保存
            </button>
        </div>

        <ion-content class="has-header">
            <label class="item item-input item-floating-label">
                <span class="input-label has-input">姓名</span>
                <input type="text" placeholder="输入姓名" ng-model="userObj.name">
            </label>
        </ion-content>
    </ion-modal-view>
</script>

<script id="emailModal.html" type="text/ng-template">
    <ion-modal-view>

        <div class="bar bar-header bar-energized-900">
            <button class="button button-icon button-clear ion-ios-arrow-back" ng-click="closeEmailModal();"></button>
            <h1 class="title" style="color:#fff;">E-mail</h1>
            <button class="button button-clear" style="top:0;bottom:0;font-size:0.8em;" ng-click="saveEmail();">保存
            </button>
        </div>

        <ion-content class="has-header">
            <label class="item item-input item-floating-label">
                <span class="input-label has-input">E-mail</span>
                <input type="text" placeholder="输入邮箱" ng-model="userObj.email">
            </label>
        </ion-content>
    </ion-modal-view>
</script>

<script id="addressModal.html" type="text/ng-template">
    <ion-modal-view>

        <div class="bar bar-header bar-energized-900">
            <button class="button button-icon button-clear ion-ios-arrow-back" ng-click="closeAddressModal();"></button>
            <h1 class="title" style="color:#fff;">我的收获地址</h1>
            <button class="button button-clear" style="top:0;bottom:0;font-size:0.8em;" ng-click="toggleManage();">管理
            </button>
        </div>

        <ion-content class="has-header has-footer">
            <div class="item item-icon-right" style="white-space: normal;"
                 ng-class="activeAddresses==item.address?'stable-bg':''"
                 ng-repeat="item in userInfo.addresses">
                <p>{{item.tel_name}}<span style="margin-left:20px">{{item.tel_telephone}}</span></p>

                <h2 style="font-size:1em;white-space: normal;">{{item.address}}</h2>
                <i class="icon ion-ios-compose-outline" ng-click="editAddress(item);"
                   style="color:#82807e;right:32px;"
                   ng-click="editAddress();" ng-if="toggleManageNum==1&&activeAddresses!=item.address"></i>
                <i class="icon ion-ios-trash-outline " ng-click="delAddress(item);" style="color:#82807e;right:0;"
                   ng-if="toggleManageNum==1&&activeAddresses!=item.address"></i>
                <input type="checkbox" ng-disabled="activeAddresses==item.address"
                       ng-init="isChoosed=activeAddresses==item.address?true:false" ng-model="isChoosed"
                       ng-change="chooseDefault(item);" style="width: 20px;height: 15px;"><span
                    style="color: #100E0E;"> 设为默认{{a}}</span>
            </div>
        </ion-content>
        <div class="bar bar-footer text-center " ng-click="openAddAddressModal();">
            <button class="button button-stable " style="width:100%;max-width:100%;background-color: #41CEF9;">
                <icon class="icon small ion-ios-plus-outline" ng-click="closeAddressModal();"></icon>
                添加新地址
            </button>
        </div>
    </ion-modal-view>
</script>
<script id="addAddress.html" type="text/ng-template">
    <ion-modal-view>

        <div class="bar bar-header bar-energized-900">
            <button class="button button-icon button-clear ion-ios-arrow-back"
                    ng-click="closeAddAddressModal();"></button>
            <h1 class="title" style="color:#fff;">添加新地址</h1>
        </div>

        <ion-content class="has-header">
            <div class="card stable-bg">
                <div class="item item-text-wrap">
                    {{userObj.address=ihg.name+nat.name+city.name+userObj.moreAddress}}
                </div>
            </div>

            <label class="item item-input item-select">
                <div class="input-label">
                    省
                </div>
                <select ng-model="ihg" ng-options="ihg.name for ihg in g">
                    <option value="">-- 省 --</option>
                </select>
            </label>
            <label class="item item-input item-select">
                <div class="input-label">
                    市
                </div>
                <select ng-model="nat" ng-options="nat.name for nat in ihg.sub">
                    <option value="">-- 市 --</option>
                </select>
            </label>
            <label class="item item-input item-select">
                <div class="input-label">
                    县
                </div>
                <select ng-model="city" ng-options="city.name for city in nat.sub">
                    <option value="">-- 县 --</option>
                </select>
            </label>
            <label class="item item-input">
                <input type="text" placeholder="详细地址" ng-model="userObj.moreAddress">
            </label>
            <label class="item item-input item-floating-label">
                <span class="input-label">手机号</span>
                <input type="text" placeholder="输入联系人手机号" ng-model="userObj.tel_telephone">
            </label>
            <label class="item item-input item-floating-label">
                <span class="input-label">联系人姓名</span>
                <input type="text" placeholder="输入联系人姓名" ng-model="userObj.tel_name">
            </label>

            <div class="padding">
                <button class="button button-block button-calm ink" data-ink-color="#9DEAFF"
                        data-ink-opacity="1" ng-click="saveNewAddress();">
                    确定
                </button>
            </div>
        </ion-content>
    </ion-modal-view>
</script>
<script id="editAddress.html" type="text/ng-template">
    <ion-modal-view>

        <div class="bar bar-header bar-energized-900">
            <button class="button button-icon button-clear ion-ios-arrow-back"
                    ng-click="closeEditAddressModal();"></button>
            <h1 class="title" style="color:#fff;">修改地址</h1>
        </div>

        <ion-content class="has-header">
            <label class="item item-input item-floating-label">
                <span class="input-label">地址</span>
                <input type="text" placeholder="输入地址" ng-model="editUserObj.address">
            </label>
            <label class="item item-input item-floating-label">
                <span class="input-label">手机号</span>
                <input type="text" placeholder="输入联系人手机号" ng-model="editUserObj.tel_telephone">
            </label>
            <label class="item item-input item-floating-label">
                <span class="input-label">联系人姓名</span>
                <input type="text" placeholder="输入联系人姓名" ng-model="editUserObj.tel_name">
            </label>

            <div class="padding">
                <button class="button button-block button-calm ink" data-ink-color="#9DEAFF"
                        data-ink-opacity="1" ng-click="saveEditAddress();">
                    确定
                </button>
            </div>
        </ion-content>
    </ion-modal-view>
</script>